package view{
	import utils.LevelConfigXmlUtils;

	public class FireBulletVO{
		private static var fireId:uint;
		/**泡泡开火的状态fireState：
		 * SKILLBAR_STATE  技能状态
		 * SYSTEM_STATE    系统状态
		 */
		public static var fireState:String;
		public static const SKILLBAR_STATE:String = "skillBar";
		public static const SYSTEM_STATE:String = "system";
		public static function randomId():uint{
			/*++++++++++++++++++思路+++++++++++++++++++++++++*/
			/*
			0-----------出现概率25%-----0~0.25
			1-----------出现概率25%-----0.25~0.5
			2-----------出现概率25%-----0.5~0.75
			3-----------出现概率8%------0.75~0.83
			4-----------出现概率8%------0.83~0.91
			5-----------出现概率9%------0.91~1.0
			*/
			var ran:Number = Math.random();
			if(ran < sumGailv(0)){
				fireId = 1;
			}else if(ran < sumGailv(1)){
				fireId = 2;
			}else if(ran < sumGailv(2)){
				fireId = 3;
			}else if(ran < sumGailv(3)){
				fireId = 4;
			}else if(ran < sumGailv(4)){
				fireId = 5;
			}else if(ran < sumGailv(5)){
				fireId = 6;
			}else if(ran < sumGailv(6)){
				fireId = 7;
			}else if(ran < sumGailv(7)){
				fireId = 8;
			}
			return fireId;
		}
		
		public static function sumGailv(id:uint):Number{
			var list:XMLList = LevelConfigXmlUtils.getInstance().xml.bulletConfig.child("group").child("item");
			var i:uint;
			var sum:Number = 0;
			for(i = 0; i <= id; i++){
				sum += Number(list[i].@gailv);
			}
			return sum;
		}
	}
}
